package com.seckill.mapper;

import com.seckill.entity.Book;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author wangzhilong
 * @date 2019-06-18
 */
public interface BookMapper {


    @Select("select * from book")
    List<Book> list();

    @Update("update book set total=total-1 where id=#{id} and total>0")
    Integer seckill(Integer id );

    @Select("select * from book where id=#{id}")
    Book getById(Integer id);

}
